﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;

namespace ArmoryBrowser.Converters
{
    public class ItemDetailsVisibilityConverter : DependencyObject, IValueConverter
    {


        public String ItemSlot
        {
            get { return (String)GetValue(ItemSlotProperty); }
            set { SetValue(ItemSlotProperty, value); }
        }

        // Using a DependencyProperty as the backing store for ItemSlot.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ItemSlotProperty =
            DependencyProperty.Register("ItemSlot", typeof(String), typeof(ItemDetailsVisibilityConverter), new PropertyMetadata(null, OnItemSlotPropertyChanged));

        
        public static void OnItemSlotPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs args)
        {
            String a = String.Empty;
        }
        
        
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                String i = (String)value;
                return i == ItemSlot;
            }
            else
            {
                return false;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                Boolean b = (Boolean)value;
                if (b)
                {
                    return ItemSlot;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }
    }
}
